from rest_framework.viewsets import ModelViewSet
from django.contrib.auth.models import Group
from apps.meiduo_admin.serializers.group import GroupSerialzier
from apps.meiduo_admin.utils import PageNum
from rest_framework.generics import ListAPIView
from django.contrib.auth.models import Permission
from apps.meiduo_admin.serializers.permission import PermissionSerializer


class GroupModelViewSet(ModelViewSet):
    queryset = Group.objects.all()

    serializer_class = GroupSerialzier

    pagination_class = PageNum


# class GroupModelViewSet(ModelViewSet):
#     queryset = Group.objects.all()
#     serializer_class = GroupSerialzier
#     pagination_class = PageNum


# 我们创建组 肯定要给组设置权限.所以我们额外写一个接口 获取所有权限.权限数据不能分页
# 获取所有的权限数据
class AllPermissionListAPIView(ListAPIView):

    queryset = Permission.objects.all()

    serializer_class = PermissionSerializer


# class AllPermissionListAPIView(ListAPIView):
#     queryset = Permission.objects.all()
#     serializer_class = PermissionSerializer
